package net.eicp.jxcontent.core.util

import net.eicp.jxcontent.core.snippet.JXDispatchSnippet
import net.liftweb.common._
import net.liftweb.http.LiftRules

object JXRules {
  
  type SnippetDispatchTP = Tuple2[PartialFunction[String, JXDispatchSnippet], PluginLevel]
  val snippetDispatch = LiftRules.RulesSeq[SnippetDispatchTP]
  
}

case class PluginLevel(name: String, level: Int)

trait PluginBoot {
  
  var pluginLevelImpl: PluginLevel = null
  def pluginLevel(pluginLevel: PluginLevel) = {
    this.pluginLevelImpl = pluginLevel
    this
  }
  
  def appendSnippetDis(dispatch: PartialFunction[String, JXDispatchSnippet]) = JXRules.snippetDispatch.append(dispatch, pluginLevelImpl)
  
  def boot
  
}